﻿
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Web;
namespace HBase {
    public class Utils {

        public static List<String> readFile() {
            List<String> lines = new List<string>();
            String line;
            try { 
                StreamReader sr = new StreamReader("ip.txt"); 
                line = sr.ReadLine(); 
                while (line != null) {
                    lines.Add(line);
                    line = sr.ReadLine();
                }
                sr.Close();

            } catch (Exception e) {
                Console.WriteLine("Exception: " + e.Message);
            }  
            return lines;

        }
        public static string ReadLine(Stream _inputStream) {
            int next_char;
            var data = "";
            int index = 1000;
            while (true) {
                try {
                    next_char = _inputStream.ReadByte();
                } catch {


                    break;

                }

                if (next_char == '\n') {
                    break;
                }
                if (next_char == '\r') {
                    continue;
                }
                if (next_char == -1) {
                    index--;
                    if (index < 0) {
                        break;
                    } else {
                        continue;
                    }

                }
                ;
                data += Convert.ToChar(next_char);
            }
            return data;
        }





    }

    public class ByteArr {
        public ByteArr(byte[] b, int i) {
            this.b = b;
            data = System.Text.Encoding.UTF8.GetString(b);
            index = i + 2;
        }

        public ByteArr(List<byte> b, int i) : this(b.ToArray(), i) {

        }
        public byte[] b;
        public String data;
        public int index;
    }


}
